﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using T.FAS.Runtime.Base.Dao;
using T.FAS.Runtime.Base.Entity;
using T.FAS.Runtime.Base.Service;
using T.FAS.Runtime.Base.SGSPI;
using T.ServiceComponent.Kernel.Service;

namespace T.FAS.Runtime.Base.SGPlugin
{
    [SGService]
    public class ValidateRulesSGService : IValidateRuleService
    {
        readonly FASValidateRuleDevService _fASValidateRuleDevService = FASValidateRuleDevService.GetInstance();

        public void CreateOrUpdateValidateRule(ValidateRule rule)
        {
            _fASValidateRuleDevService.CreateOrUpdateRule(rule);
        }

        public void DeleteValidateRules(string id)
        {
            _fASValidateRuleDevService.DeleteRule(id);
        }

        public List<ValidateRule> GetValidateRules(string filter = null)
        {
            return _fASValidateRuleDevService.GetRules(filter);
        }

        /// <summary>
        /// 创建或更新
        /// </summary>
        /// <param name="chart"></param>
        public void BatchUpdateValidateRules(List<ValidateRule> rules)
        {
            _fASValidateRuleDevService.BatchUpdateValidateRules(rules);
        }

        /// <summary>
        /// 创建或更新
        /// </summary>
        /// <param name="chart"></param>
        public void BatchDeleteValidateRules(List<string> rules)
        {
            _fASValidateRuleDevService.BatchDeleteValidateRules(rules);
        }
    }
}
